package com.atzzy.ysmall.ysmall_api.CollectionController;

import com.alibaba.dubbo.config.annotation.Reference;
import com.atzzy.ysmall.ysmall_allService.ProductService.CollectionService;
import com.atzzy.ysmall.ysmall_beans.CollectionShop;
import com.atzzy.ysmall.ysmall_common.vo.R;
import org.springframework.web.bind.annotation.*;

/**
 * @Author JAVAZeng
 * @Date 2022/4/12 13:57
 * @Version 1.0
 */
@RestController
@RequestMapping("CollectionService")
@CrossOrigin
public class CollectionController {

    @Reference
    private CollectionService collectionService;

    @PostMapping("putlist")
    public R insertTheCollection(@RequestBody CollectionShop collectionShop){
        return collectionService.insertCollection(collectionShop);
    }

    @GetMapping("listAll")
    public R listAllCollection(@RequestParam("userId") String userId)
    {
        return collectionService.selectCollection(userId);
    }

    @DeleteMapping("deleteOne")
    public R deleteCollection(@RequestParam("collectionId") int collectionId){
        return collectionService.deleteCollection(collectionId);
    }
}
